﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sustainalytics.DataLayer;

namespace CleanupAccountsInRedis
{
    class RedisCleanup
    {
        public void Execute(string connString)
        {
            var accountRepo = AccountsRepository.GetAccountsRepository(connString);

            var opClaimsRetriever = new OperationClaimsRetrieverEx();

            accountRepo.GetAccountsByds().ForEach(a => 
            { 
                opClaimsRetriever.DeleteAccountFromRedis(a.Name); 
                Console.WriteLine(String.Format("Deleting key from Redis: \"{0}\"", a.Name)); 
            });
        }
    }
}
